[Analytics Hub] Add analytics event to track when date range selection fails #8359
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #8350
Description
Adds a new analytics event to track when date range selection fails, to detect and better understand problems with specific calendars, time zones, and dates:
analytics_hub_date_range_selection_failed(Event registration: 1240-gh-tracks-events-registration)This event is triggered when a
AnalyticsHubTimeRangeSelection.TimeRangeGeneratorErroris thrown in the Analytics Hub.Testing
You can force a failed date range selection by temporarily editing one of the methods that unwraps the time range to always throw an error:
woocommerce-ios/WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/AnalyticsHubTimeRangeSelection.swift
Lines 68 to 73 in 0af536a
To test:
analytics_hub_date_range_selection_failedis triggered with custom propsoption(with the selected date range option),calendar(with your device calendar), andtimezone(with your device timezone).Alternately, you can edit one of the methods in
Date+StartAndEnd.swiftto returnnil. In that case, the event should be triggered when you select the relevant date range in the Analytics date range selector.Submitter Checklist
Update release notes:
RELEASE-NOTES.txtif necessary.